package com.augmentum.springcloudorderservice.controller;

import com.augmentum.springcloudorderservice.feignclient.ProductClient;
import com.augmentum.springcloudproductservice.dto.UserDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/feign")
@RestController
@Slf4j
public class FeignHelloController {

    @Resource
    private ProductClient productClient;

    @GetMapping("/msg")
    public String hello(String name) {
        log.info("name: " + name);
        UserDTO userDTO = new UserDTO();
        userDTO.setName(name);
        userDTO.setId(1);
        return productClient.hello(userDTO);
    }
}
